/**

This file is part of MaCI/GIMnet.

MaCI/GIMnet is free software: you can redistribute it and/or modify it 
under the terms of the GNU Lesser General Public License as published 
by the Free Software Foundation, either version 3 of the License, or 
(at your option) any later version.

MaCI/GIMnet is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
License for more details.

You should have received a copy of the GNU Lesser General Public 
License along with GIMnet. (See COPYING.LESSER) If not, see 
<http://www.gnu.org/licenses/>.

**/
#ifndef SIMWINDOW_H
#define SIMWINDOW_H

#include "wx/wx.h"
#include "wx/glcanvas.h"

#include "World.h"

class CSimCanvas : public wxGLCanvas
{
  DECLARE_EVENT_TABLE()
  public:
    CSimCanvas(wxWindow *ParentWindow, int id, int* attribList);
    ~CSimCanvas();
    
    void OnKey(wxKeyEvent &e);
    void OnSize(wxSizeEvent &e);
    void SetView();
    
  private:
    bool reset;
    float z,y,x, pan,tilt;
};

class CSimWindow : public wxFrame , public wxThread
{
  DECLARE_EVENT_TABLE()
  public:
    int attribList[];
    CSimCanvas *GLCanvas;
    wxGLContext *GLContext;
    
    CSimWindow();
    ~CSimWindow();
  
    void KeyFunc(wxKeyEvent &e);
    void MouseFunc(wxMouseEvent &e);
    void MouseWheel(wxMouseEvent &e);
    void* Entry();
  
  private:
    CWorld World;
    
    void init();
    void simulate();
}; 

#endif //SIMWINDOW_H
